package cn.itsource.ymcc.client;

import cn.itsource.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseClientFallbackFactory implements FallbackFactory<CourseClient> {

    @Override
    public CourseClient create(Throwable throwable) {
        return new CourseClient() {
            @Override
            public JSONResult loadByLoginIdAndCourseId(Long loginId, Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务 loadByLoginIdAndCourseId 接口调用失败！" + throwable.getMessage());
            }
        };
    }
}
